<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	template="../WEB-INF/layout/template.xhtml">

	<ui:define name="left_content">
		<s:link view="/admin/supportedlanguagedetail.xhtml"
			value="#{messages['jsf.CreateSupportedLanguage']}" />
	</ui:define>

	<ui:define name="center_content">

		<script type="text/javascript">
        function confirmDelete()
        {
          return confirm("#{messages['jsf.AreYouSureYouWishToDeleteThisLanguageThisActionCannotBeUndone']}");
        }
        function confirmDisable()
        {
          return confirm("#{messages['jsf.AreYouSureYouWishToDisableThisLanguage']}");
        }
        function confirmEnable()
        {
          return confirm("#{messages['jsf.AreYouSureYouWishToEnableThisLanguage']}");
        }
      </script>
		<rich:panel>
			<f:facet name="header">#{messages['jsf.LanguageManager']}</f:facet>

			<a4j:form>
				<s:token allowMultiplePosts="true" />
				<rich:dataTable id="threads" value="#{allLanguages}"
					var="language">

					<rich:column sortBy="#{language.localeId.id}">
						<f:facet name="header">#{messages['jsf.Language']}</f:facet>
	            		#{language.localeId.id}
	        		</rich:column>
					<rich:column sortBy="#{language.retrieveDisplayName()}">
						<f:facet name="header">#{messages['jsf.Name']}</f:facet>
	            		#{language.retrieveDisplayName()}
	        		</rich:column>
					<rich:column >
						<f:facet name="header">#{messages['jsf.NativeName']}</f:facet>
	            		#{language.retrieveNativeName()}
	        		</rich:column>
					<rich:column rendered="#{language.active}">
						<f:facet name="header">#{messages['jsf.Actions']}</f:facet>
						<h:commandButton value="#{messages['jsf.Disabled']}" 
							action="#{languageSearchAction.disable(languageSearchAction.selectedLanguage)}"
							onclick="return confirmDisable()" />
					</rich:column>
					<rich:column rendered="#{!language.active}">
						<f:facet name="header">#{messages['jsf.Actions']}</f:facet>
						<h:commandButton value="#{messages['jsf.Enable']}" 
							action="#{languageSearchAction.enable(languageSearchAction.selectedLanguage)}"
							onclick="return confirmEnable()" />
					</rich:column>
				</rich:dataTable>
			</a4j:form>
		</rich:panel>
	</ui:define>

</ui:composition>
